// 题目详情相关的视图对象（VO）

// 标签接口
export interface TagInfo {
  id: number;
  name: string;
  color: string;
  oj: string;
  gid: number;
  tcid: number;
  createTime: string;
  updateTime: string;
}

// 题目统计信息接口
export interface ProblemCount {
  total: number;
  easy: number;
  medium: number;
  hard: number;
}

// 题目统计信息接口（详细版）
export interface ProblemCountVO {
  pid: number;
  total: number;
  ac: number;
  mle: number;
  tle: number;
  re: number;
  pe: number;
  ce: number;
  wa: number;
  se: number;
  pa: number;
}

// 题目基本信息
export interface Problem {
  problemId: string;
  title: string;
  difficulty: number;
  tags?: TagInfo[];
}

// 题目列表响应
export interface ProblemListResponse {
  code: number;
  message: string;
  data: {
    total: number;
    pages: number;
    list: Problem[];
  };
}

// 管理员端题目信息接口
export interface ProblemEntityAdminVO {
  id: number;
  content: string;
  problemId: string;
  status: number;
  title: string;
  author: string;
  type: number;
  timeLimit: number;
  memoryLimit: number;
  stackLimit: number;
  description: string;
  inputDescription: string;
  outputDescription: string;
  examples: string;
  isRemote: number;
  source: string;
  difficulty: number;
  hint: string;
  auth: number;
  ioScore: number;
  codeShare: number;
  judgeMode: string;
  judgeCaseMode: string;
  userExtraFile: string;
  judgeExtraFile: string;
  spjCode: string;
  spjLanguage: string;
  isRemoveEndBlank: number;
  openCaseResult: number;
  isUploadCase: number;
  caseVersion: string;
  modifiedUser: string;
  isGroup: number;
  gid: number;
  applyPublicProgress: number;
  isFileIo: number;
  ioReadFileName: string;
  ioWriteFileName: string;
  createTime: string;
  updateTime: string;
}

// 题目信息VO接口
export interface ProblemInfoVO {
  problem: any; // 完整题目信息
  problemEntityUserVO: any; // 用户端显示的题目信息
  problemEntityAdminVO: ProblemEntityAdminVO; // 管理员端显示的题目信息
  tags: TagInfo[]; // 题目标签
  languages: string[]; // 题目可用编程语言
  problemCount: ProblemCountVO; // 题目提交统计情况
  codeTemplate?: { [key: string]: string }; // 代码模板
}

// 题目详情响应
export interface ProblemDetailResponse {
  code: number;
  message: string;
  data: ProblemInfoVO;
}

// 代码运行响应
export interface CodeRunResponse {
  code: number;
  message: string;
  data: {
    output: string;
    error?: string;
    time?: number;
    memory?: number;
  };
}

// 代码提交响应
export interface CodeSubmitResponse {
  code: number;
  message: string;
  data?: {
    submissionId: string;
    status: string;
  };
}

// 判题信息接口
export interface JudgeInfo {
  time: number;
  message: string;
  memory: number;
  result: number;
  isPassed: boolean; // 前端使用，根据result判断是否通过
  output?: string; // 测试点输出内容
}

// 执行代码响应接口
export interface ExecuteCodeResponse {
  outputList: string[];
  message: string;
  status: number;
  memory: number;
  time: number;
  accepted: boolean;
  judgeInfo: JudgeInfo[];
}

// 执行代码响应包装接口
export interface ResultExecuteCodeResponse {
  code: number;
  message: string;
  data: ExecuteCodeResponse;
}